﻿CREATE TABLE [dbo].[Cotizacion] (
    [Id]              INT             IDENTITY (1, 1) NOT NULL,
    [EmpresaId]       INT             NOT NULL,
    [ClienteId]       INT             NULL,
    [UsuarioId]       INT             NULL,
    [VendedorId]      INT             NULL,
    [MaterialId]      INT             NULL,
    [LineaId]         INT             NULL,
    [Fecha]           DATETIME        NULL,
    [PrecioUnitario]  MONEY           NULL,
    [Subtotal]        MONEY           NULL,
    [Porcentaje]      MONEY           NULL,
    [TotalUSD]        MONEY           NULL,
    [TotalCol]        MONEY           NULL,
    [Cantidad]        INT             NULL,
    [Montaje]         DECIMAL (10, 2) NULL,
    [Base]            DECIMAL (10, 2) NULL,
    [Altura]          DECIMAL (10, 2) NULL,
    [Tintas]          DECIMAL (10, 2) NULL,
    [Cubrimiento]     DECIMAL (10, 2) NULL,
    [Troquel]         DECIMAL (10, 2) NULL,
    [Doblez]          DECIMAL (10, 2) NULL,
    [Cuatricromia]    DECIMAL (10, 2) NULL,
    [Otro]            DECIMAL (10, 2) NULL,
    [Evento]          BIT             NULL,
    [PorcEvento]      DECIMAL (10, 2) NULL,
    [Aplicada]        BIT             NULL,
    [FecAplicada]     DATETIME        NULL,
    [FecRegistro]     DATETIME        NULL,
    [NumPedido]       VARCHAR (20)    NULL,
    [PrecioMaterial]  MONEY           NULL,
    [PrecioTintas]    MONEY           NULL,
    [PrecioArte]      MONEY           NULL,
    [PrecioImpresion] MONEY           NULL,
    [PrecioMolde]     MONEY           NULL,
    [PrecioCorte]     MONEY           NULL,
    [PrecioPositivo]  MONEY           NULL,
    [PrecioSolvente]  MONEY           NULL,
    [Rendimiento]     DECIMAL (10, 2) NULL,
    [Laminas]         DECIMAL (10, 2) NULL,
    [Observacion]     VARCHAR (500)   NULL,
    [TipoCambioId]    INT             NULL,
    [DivLargo]        DECIMAL (10, 2) NULL,
    [DivAncho]        DECIMAL (10, 2) NULL,
    CONSTRAINT [PK_Cotizacion] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_Cotizacion_Cliente] FOREIGN KEY ([ClienteId]) REFERENCES [dbo].[Cliente] ([Id]),
    CONSTRAINT [FK_Cotizacion_Empresa] FOREIGN KEY ([EmpresaId]) REFERENCES [dbo].[Empresa] ([Id]),
    CONSTRAINT [FK_Cotizacion_Linea] FOREIGN KEY ([LineaId]) REFERENCES [dbo].[Linea] ([Id]),
    CONSTRAINT [FK_Cotizacion_Material] FOREIGN KEY ([MaterialId]) REFERENCES [dbo].[Material] ([Id]),
    CONSTRAINT [FK_Cotizacion_TipoCambio] FOREIGN KEY ([TipoCambioId]) REFERENCES [dbo].[TipoCambio] ([Id]),
    CONSTRAINT [FK_Cotizacion_Usuario] FOREIGN KEY ([UsuarioId]) REFERENCES [dbo].[Usuario] ([Id]),
    CONSTRAINT [FK_Cotizacion_Vendedor] FOREIGN KEY ([VendedorId]) REFERENCES [dbo].[Vendedor] ([Id])
);

